#include<vector>
using namespace std;

class Solution {
public:
    int countTarget(vector<int>& scores, int target) {
        int n = scores.size();
        int left = 0, right = n - 1;
        if (scores.size() == 0)return 0;
        while (left < right) {
            int mid = (left + right) / 2;
            if (scores[mid] < target)left = mid + 1;
            else right = mid;
        }
        int cnt = 0;
        while (left < scores.size() && scores[left] == target) {
            cnt++;
            left++;
        }
        return cnt;
    }
};